package com.xlh.constant;

import com.xlh.param.course.FileParam;

import java.util.HashMap;
import java.util.Map;

/**
 * 用户常量
 * <p>
 * Created by lx on 2019/2/18.
 */
public class UserConstant {

    /**
     * 验证码session的key
     */
    public static final String CODE_SESSION_KEY = "TES_IMAGE_CODE";

    /**
     * 验证码session失败的次数
     */
    public static final String CODE_FAIL_NUM = "TES_IMAGE_CODE_FAIL_NUM";

    /**
     * 验证码过期时间
     */
    public static final Integer CODE_EXPIRED_TIME = 60 * 10;

    /**
     * 短信验证码session的key
     */
    public static final String SMS_CODE_SESSION_KEY = "TES_SMS_CODE";

    /**
     * 手机号session的key
     */
    public static final String MOBILE_TEL_SESSION_KEY = "TES_MOBILE_TEL";

    /**
     * 短信验证码过期时间
     */
    public static final Integer SMS_CODE_EXPIRED_TIME = 60 * 2;

    /**
     * 发送短信验证码失败的key
     */
    public static final String SMS_SEND_FAIL_SESSION_KEY = "TES_SMS_SEND_FAIL";

    /**
     * 发送短信验证码失败过期时间
     */
    public static final Integer SMS_SEND_FAIL_EXPIRED_TIME = 60 * 5;

    /**
     * 用户常用ip总数
     */
    public static final Integer COMMON_IP_COUNT = 15;

    /**
     * 邮箱正则
     */
    public static final String REGEX_EMAIL = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$";

    /**
     * 密码正则
     * 必须是数字和英文
     * ^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,14}
     */
    public static final String REGEX_PASSWORD = "^[0-9A-Za-z]{6,14}$";

    /**
     * 纯数字验证
     */
    public static final String REGEX_NUMBER = "^\\d+$";

    /**
     * 根据ip获取详细信息接口地址
     */
    public static final String GET_REGION_URL = "http://ip.taobao.com/service/getIpInfo.php?ip={}";

    /**
     * 初始化密码
     */
    public static final String INIT_PASSWORD = "000000";

    /**
     * 教师excel头部
     */
    public static final Map<String, String> TEACHER_SPECIAL_HEADER = new HashMap<String, String>() {
        {
            put("姓名", "name");
            put("工号", "userNumber");
            put("性别", "sexName");
            put("手机号", "telephoneNumber");
            put("邮箱", "email");
            put("密码", "password");
            put("角色", "roleName");
            put("省份", "province");
            put("学校", "schoolName");
            put("申请人", "applicant");
            put("销毁日期", "destroyTimeStr");
        }
    };

    /**
     * 普通教师excel头部
     */
    public static final Map<String, String> TEACHER_COMMON_HEADER = new HashMap<String, String>() {
        {
            put("姓名", "name");
            put("工号", "userNumber");
            put("性别", "sexName");
            put("手机号", "telephoneNumber");
            put("邮箱", "email");
            put("密码", "password");
        }
    };

    /**
     * 学生excel头部
     */
    public static final Map<String, String> STUDENT_COMMON_HEADER = new HashMap<String, String>() {
        {
            put("姓名", "name");
            put("学号", "userNumber");
            put("性别", "sexName");
            put("手机号", "telephoneNumber");
            put("邮箱", "email");
            put("学校", "schoolName");
        }
    };

    /**
     * 技能头部
     */
    public static final Map<String, String> SKILL_HEADER = new HashMap<String, String>() {
        {
            put("岗位", "post");
            put("职责描述", "describe");
            put("技能模块", "skillModule");
            put("子技能", "subSkill");
            put("知识点", "knowledgePoints");
            put("对应课程", "courseName");
        }
    };

    /**
     * 用户下载文件
     */
    public static final Map<String, FileParam> DOWNLOAD_FILE_MAP = new HashMap<>();

}


